package com.dhsc.exception;

import java.util.HashMap;
import java.util.Map;

import org.springframework.beans.InvalidPropertyException;
import org.springframework.validation.BindException;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * @ClassName:  BindExceptionAdapter
 * @Description: 非法参数异常的统一处理类
 * @date:   2023年5月25日 下午6:30:14       
 * @author: clong
 * @Copyright:  东海运营
 */
@ControllerAdvice
public class BindExceptionAdapter
{
	@ExceptionHandler({BindException.class,InvalidPropertyException.class})
	@ResponseBody
	public Map<String,Object> exceptionAdapter()
	{
		Map<String,Object> map=new HashMap<>();
		map.put("http", 500);
		map.put("info","非法参数");
		return map;
	}
}
